/**
 * This file is part of the dspace-poltman project http://www.poltman.com.
 *
 * This is free software; you can redistribute it and/or modify it under
 * the terms of DuraSpace DSpace license detailed in the LICENSE and NOTICE 
 * files at the root of the source tree and available online at
 * http://www.dspace.org/license/
 * 
 */
package com.poltman.dscentral.epeople;

import java.util.ArrayList;
import java.util.List;

import org.apache.log4j.Logger;
import org.zkoss.zkplus.spring.SpringUtil;

import com.poltman.dscentral.db.entity.pm.LanguagesEntity;
import com.poltman.dscentral.db.service.pm.LanguagesService;



/**
 * 
 * @author Zbigniew Ciok; z.ciok@poltman.com
 * @version $Revision: 1564 $
 * 
 */
public class AddEPeopleModel {
	
	private static Logger log = Logger.getLogger(AddEPeopleModel.class);
	
	private String userId;				//dspace netid - ldap cn; when password authentication userId = email
	private String userEmail;
	private String lastName;
	private String firstName;
	private String phone;
	private Boolean dscentralOperator;
	private Boolean canLogIn;
	private Boolean requiredCertificate;
	private String authentication;
	private String language;
	
	private List<String> languagesNames;
	
	
	public String getUserId() {
		return userId;
	}
	public void setUserId(String userId) {
		this.userId = userId;
	}
	
	public String getUserEmail() {
		return userEmail;
	}
	public void setUserEmail(String userEmail) {
		this.userEmail = userEmail;
	}
	
	public String getLastName() {
		return lastName;
	}
	public void setLastName(String lastName) {
		this.lastName = lastName;
	}
	
	public String getFirstName() {
		return firstName;
	}
	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}
	
	public String getPhone() {
		return phone;
	}
	public void setPhone(String phone) {
		this.phone = phone;
	}
	
	public Boolean getDscentralOperator() {
		return dscentralOperator;
	}
	public void setDscentralOperator(Boolean dscentralOperator) {
		this.dscentralOperator = dscentralOperator;
	}
	
	public Boolean getCanLogIn() {
		return canLogIn;
	}
	public void setCanLogIn(Boolean canLogIn) {
		this.canLogIn = canLogIn;
	}
	
	public Boolean getRequiredCertificate() {
		return requiredCertificate;
	}
	public void setRequiredCertificate(Boolean requiredCertificate) {
		this.requiredCertificate = requiredCertificate;
	}
	
	public String getAuthentication() {
		return authentication;
	}
	public void setAuthentication(String authentication) {
		this.authentication = authentication;
	}
	
	public String getLanguage() {
		return language;
	}
	public void setLanguage(String language) {
		this.language = language;
	}
	
	public List<String> getLanguagesNames() {
		try {
			LanguagesService  languagesService = (LanguagesService) SpringUtil.getBean("languagesService");
			List<LanguagesEntity> languages = languagesService.findByImplemented(true);
			this.languagesNames = new ArrayList<String>();
			this.languagesNames.add("");
			for (LanguagesEntity langs : languages) this.languagesNames.add(langs.getName());
		} catch (Exception e) {
			log.error("AddEPeopleModel getLanguagesNames Error. ", e);
		}		
		return languagesNames;
	}

	public void setLanguagesNames(List<String> languagesNames) {
		this.languagesNames = languagesNames;
	}
}
